#include "junix.h"

int main(int argc, char **argv)
{
	if(argc==1)
		err_quit("Usage:%s file",argv[0]);

	int ret;
	ret=access(argv[1],F_OK);
	if(ret==-1)
		err_sys("access");
	printf("File exist.\n");

	ret=access(argv[1],R_OK);
	if(ret==-1)
		err_sys("access");
	printf("File R_OK.\n");

	ret=access(argv[1],W_OK);
	if(ret==-1)
		err_sys("access");
	printf("File W_OK.\n");

	ret=access(argv[1],X_OK);
	if(ret==-1)
		err_sys("access");
	printf("File X_OK.\n");

	return 0;
}

